constraint
1 つのオブジェクトを 1 つ以上のコンストレイント オブジェクトに拘束します。 コンストレイントは、被コンストレイント オブジェクトのキネマティクス プロパティの下にあります。 SIApplyCnsは、コンストレイントのプロパティページを表示しないという点でApplyCnsと異なります。
oReturn = SIApplyCns( PresetObj, [ConstrainedObj], [ConstrainingObj], [Compensation] ); |
Constraint オブジェクトの XSICollection を戻します。
| パラメータ | タイプ | 詳細 |
|---|---|---|
| PresetObj | 文字列 またはプリセット オブジェクト(「SIGetPreset」を参照) | コンストレイントプリセット。 警告: Linux のプリセット名では、大文字と小文字が区別されます。 |
| ConstrainedObj | 文字列 | 拘束されるオブジェクトのリスト。
変数を渡すと、コマンドは拘束されるX3DObjectのXSICollectionを戻します。
デフォルト値: 選択されたオブジェクト |
| ConstrainingObj | 文字列 | コンストレイント オブジェクトのリスト。
変数を渡すと、コマンドは拘束されるX3DObjectのXSICollectionを戻します。
デフォルト値:ユーザが指定します。 |
| Compensation | ブール | 補正をオンにする場合は True
デフォルト値: False |
'
' Orientation constrain two cones to a cube, compensating one of them.
'
dim oCube, oConeCompensated, oConeUncompensated
'
' get a cube and rotate it so we can see how orientation is being constrained.
'
set oCube = GetPrim("Cube")
oCube.length = 2
Scale oCube, 0.5, 3, 0.5, siRelative, siLocal, siObj, siXYZ
Rotate oCube, 45, 0, 45, siRelative, siAdd, siObj, siXYZ
'
' create the two cones and put on either side of the cube
'
set oConeCompensated = GetPrim("Cone")
Translate oConeCompensated, -4, 0, 0, siAbsolute, siParent, siObj, siXYZ
set oConeUncompensated = GetPrim("Cone")
Translate oConeUncompensated, 4, 0, 0, siAbsolute, siParent, siObj, siXYZ
'
' Apply the constraints
'
SIApplyCns "Orientation", oConeCompensated, oCube, true
SIApplyCns "Orientation", oConeUncompensated, oCube, false
'
' display the constraint relationship in the camera view
'
SetValue "Camera.camvis.*constraint*", True
'
' log the constraint offsets to show
' that one has been compensated
'
dim comp_x,comp_y,comp_z,uncomp_x,uncomp_y,uncomp_z
comp_x = GetValue( oConeCompensated&".kine.oricns.offx")
comp_y = GetValue( oConeCompensated&".kine.oricns.offy")
comp_z = GetValue( oConeCompensated&".kine.oricns.offz")
uncomp_x = GetValue( oConeUncompensated&".kine.oricns.offx")
uncomp_y = GetValue( oConeUncompensated&".kine.oricns.offy")
uncomp_z = GetValue( oConeUncompensated&".kine.oricns.offz")
logmessage "Compensated cone offsets: x= " & comp_x & " y= " & comp_y & " z= " & comp_z
logmessage "Uncompensated cone offsets: x= " & uncomp_x & " y= " & uncomp_y & " z= " & uncomp_z
'Results of running this script:
'INFO : "Compensated cone offsets: x= -35.2643896827547 y= -30 z= -35.2643896827547"
'INFO : "Uncompensated cone offsets: x= 0 y= 0 z= 0"
|